{template 'member','header'}
<div id="main"> {template "member","left"}
  <div id="right">
    <p id="position"><strong>当前位置：</strong><a href="">首页</a><a href="{$M[url]}member.php">我的广告</a><a>广告统计</a>{$info_ads['adsname']}</p>
    
	<form name='myform' action='{$M[url]}stat.php' method='get'>
    <table cellpadding="0" cellspacing="1" class="table_form">
      <tr>
        <th>按时间段统计：</th><td><input type='hidden' name='adsid' value='{$adsid}'><input type='hidden' name='type' value='1'> {form::date("from")} - {form::date('end')} <input type="submit" value="查询"></td>
      </tr>
    </table>
	</form>
    <div class="tag_menu">
	    <ul>
          <li><a href="{$M[url]}stat.php?type=1&adsid={$adsid}">按所属地域排序</a></li>
          <li><a href="{$M[url]}stat.php?type=2&adsid={$adsid}">按访问者IP排序</a></li>
          <li><a href="{$M[url]}stat.php?type=3&adsid={$adsid}">按访问用户排序</a></li>
          <li><a href="{$M[url]}stat.php?type=4&adsid={$adsid}">按访问页面排序</a></li>
        </ul>
    </div>
	<table cellpadding="0" cellspacing="1" class="table_list">
      {if $type==1}
      <tr>
        <th width="30%">所属地域</th>
        <th width="69%" colspan="3">展示次数</th>
      </tr>
      {loop $states[1] $i $stat}
      <tr>
        <td>{$stat[area]}</td>
        <td colspan="3">{$stat[num]}</td>
      </tr>
      {/loop}
	  {elseif $type==3}
      <tr>
        <th width="24%">用户名</th>
        <th colspan="3">展示次数</th>
      </tr>
      {loop $states[1] $i $stat}
      <tr>
        <td>{$stat[username]}</td>
        <td colspan="3">{$stat[num]}</td>
      </tr>
      {/loop}
      {elseif $type==4}
      <tr>
        <th width="85%">展示页面</th>
        <th width="15%" colspan='3'>展示次数</th>
      </tr>
      {loop $states[1] $i $stat}
      <tr>
        <td style="text-align:left"><a href="{$stat[referer]}" target="_blank">{str_cut($stat[referer], 100)}</a></td>
        <td colspan='3'>{$stat[num]}</td>
      </tr>
      {/loop}
      {else}
      <tr>
        <th>IP</th>
        <th>所属地域</th>
        <th>展示时间</th>
        <th>展示次数</th>
      </tr>
      {loop $states[1] $i $stat}
      <tr>
        <td>{$stat[ip]}</td>
        <td>{$stat[area]}</td>
        <td>{date('Y-m-d H:i', $stat[clicktime])}</td>
        <td>{$stat[num]}</td>
      </tr>
      {/loop}
      {/if}
    </table>
  </div>
</div>
{template 'phpcms', 'footer'}